package com.example.jetour_line.map.mapview;


import android.app.Fragment;
import android.os.Bundle;

//空白Fragment
public class LifeListenerFragment extends Fragment {
    private LifeListener mLifeListener;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (mLifeListener != null) {
            mLifeListener.onCreate(savedInstanceState);
        }
    }

    public void addLifeListener(LifeListener listener) {
        mLifeListener = listener;
    }

    public void removeLifeListener() {
        mLifeListener = null;
    }


    @Override
    public void onStart() {
        super.onStart();
        if (mLifeListener != null) {
            mLifeListener.onStart();
        }
    }

    @Override
    public void onStop() {
        super.onStop();
        if (mLifeListener != null) {
            mLifeListener.onStop();
        }
    }

    @Override
    public void onResume() {
        super.onResume();

        if (mLifeListener != null) {
            mLifeListener.onResume();
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();

        if (mLifeListener != null) {
            mLifeListener.onDestroy();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        if (mLifeListener != null) {
            mLifeListener.onPause();
        }
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }

    //生命周期回调接口
    public interface LifeListener {

        void onCreate(Bundle bundle);

        void onStart();

        void onResume();

        void onPause();

        void onStop();

        void onDestroy();

        void onSaveInstanceState(Bundle outState);
    }

}

